// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   StockNameRenderer.java

package com.boci.clientapp.orderstatus.ui.control;

import com.boci.common.constant.ClientAppConst;
import java.awt.Color;
import java.awt.Component;
import java.util.Locale;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.border.EmptyBorder;
import javax.swing.table.TableCellRenderer;

public class StockNameRenderer extends JLabel
    implements TableCellRenderer
{

    public StockNameRenderer(Locale pLocale)
    {
        setBorder(new EmptyBorder(0, 0, 0, 0));
        currentLocale = pLocale;
    }

    public void setText(Locale pLocale)
    {
        currentLocale = pLocale;
    }

    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
    {
        strNames = (String[])(String[])value;
        String strName;
        if(currentLocale.equals(ClientAppConst.ZH_CN) && strNames[2] != null && strNames[2].length() != 0)
            strName = strNames[2];
        else
        if(currentLocale.equals(ClientAppConst.ZH_HK) && strNames[1] != null && strNames[1].length() != 0)
            strName = strNames[1];
        else
            strName = strNames[0];
        setToolTipText(strName);
        setText(strName);
        setOpaque(true);
        if(!table.isRowSelected(row) || !table.hasFocus())
            if(row % 2 == 0)
            {
                setBackground(new Color(255, 255, 200));
                setForeground(table.getForeground());
            } else
            {
                setBackground(Color.WHITE);
                setForeground(table.getForeground());
            }
        return this;
    }

    private String strNames[];
    private Locale currentLocale;
}
